//
//  UIView+Frame.swift
//  TodayNews
//
//  Created by monkey on 2020/2/17.
//  Copyright © 2020 itcast. All rights reserved.
//

import UIKit

extension UIView
{
    var x: CGFloat {
        set {
            var rect = frame
            rect.origin.x = newValue
            frame = rect
        }
        get {
            return frame.origin.x
        }
    }
    
    var y: CGFloat {
        set {
            var rect = frame
            rect.origin.y = newValue
            frame = rect
        }
        get {
            return frame.origin.y
        }
    }

    var width: CGFloat {
        set {
            var rect = frame
            rect.size.width = newValue
            frame = rect
        }
        get {
            return bounds.size.width
        }
    }
    
    var height: CGFloat {
        set {
            var rect = frame
            rect.size.height = newValue
            frame = rect
        }
        get {
            return bounds.size.height
        }
    }
    
    var origin: CGPoint {
        set {
            var rect = frame
            rect.origin = newValue
            frame = rect
        }
        get {
            return frame.origin
        }
    }
}
